import * as actionTypes from "./actionTypes";

//  import axios from 'axios'
export const changeUser = (data) => ({
    type: actionTypes.ChangeUser,
    data: data,
})
export const changeType = (data) => ({
    type: actionTypes.ChangeType,
    data: data,
})
export const quitHandle = (data) => ({
    type: actionTypes.QuitHandle,
    data: data,
})
export const loginHandle = (data) => ({
    type: actionTypes.LoginHandle,
    data: data.isLogin,
})
export const login = (value) => {
    return (dispatch) => {
        // axios.post("/index.json").then(res => {
        //     console.log("*****",res)
        //     if (res.status === 200) {
        //         var result = res.data.data ;
        let obj=Object.assign({},value,{id:123,verifyText:"1656273980",imgUrl:"https://upload.jianshu.io/users/upload_avatars/7042805/ace5c873-086b-46b9-a167-d53630fd03aa.jpg",isLogin:true,userName:"新用户",email:"2378862893@qq.com"})
     
        var result = { code: 200, msg: '成功', isLogin: true };
        dispatch(loginHandle(result))
        dispatch(changeUser(obj))
        // }
        // })
    }
}